﻿using System;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02001016 RID: 4118
	internal class Process_PtcG2C_BattleResultNtf
	{
		// Token: 0x0600D4FE RID: 54526 RVA: 0x00322BB0 File Offset: 0x00320DB0
		public static void Process(PtcG2C_BattleResultNtf roPtc)
		{
            if (roPtc.Data != null && roPtc.Data.stageInfo != null)
            {
                XLevelRewardDocument specificDocument = XDocuments.GetSpecificDocument<XLevelRewardDocument>(XLevelRewardDocument.uuID);
                if (specificDocument.RequestServer || XSingleton<XGame>.singleton.SyncMode)
                {
                    if (!XSingleton<XLevelFinishMgr>.singleton.HaveBattleResultData)
                    {
                        if (specificDocument.CurrentScene == roPtc.Data.stageInfo.stageID)
                        {
                            XSingleton<XLevelFinishMgr>.singleton.HaveBattleResultData = true;
                            specificDocument.RequestServer = false;
                            XSingleton<XCutScene>.singleton.Stop(true);
                            if (roPtc.Data.stageInfo.isStageFailed)
                            {
                                XSingleton<XLevelFinishMgr>.singleton.OnLevelFailed();
                            }
                            else
                            {
                                if (!XSingleton<XScene>.singleton.bSpectator)
                                {
                                    specificDocument.SetBattleResultData(roPtc.Data);
                                }
                                XSingleton<XLevelFinishMgr>.singleton.IsCurrentLevelWin = true;
                                XSingleton<XLevelFinishMgr>.singleton.StartLevelFinish();
                            }
                            XSingleton<XOperationRecord>.singleton.DoScriptRecord(roPtc.Data.stageInfo.stageID + "after");
                            XStaticSecurityStatistics.OnEnd();
                        }
                    }
                }
            }
        }
	}
}
